package com.jyw.business.obstacles.expand.controller;

import com.jyw.business.de.domain.dto.web.ObsDemandAddDto;
import com.jyw.business.de.domain.dto.web.ObsTaskAddDto;
import com.jyw.business.obstacles.domain.dto.web.OrderUpgradeDto;
import com.jyw.business.obstacles.expand.service.IObsDemandService;
import com.jyw.common.core.domain.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "报障扩展-需求模块")
@RestController
@RequestMapping("/obs/demand")
public class ObsDemandController {

    @Resource
    private IObsDemandService obsDemandService;

    /**
     * 工单转需求
     * @param orderDto
     * @return
     */
    @PutMapping("transfer/demand")
    @PreAuthorize("@ss.hasPermi('obstacles:mine:order:make')")
    @ApiOperation("工单转需求")
    public CommonResult transferDemand(@RequestBody ObsDemandAddDto orderDto){
        obsDemandService.transferDemand(orderDto);
        return CommonResult.success();
    }


    /**
     * 工单转任务
     * @param orderDto
     * @return
     */
    @PutMapping("transfer/task")
    @PreAuthorize("@ss.hasPermi('obstacles:mine:order:make')")
    @ApiOperation("工单转任务")
    public CommonResult transferTask(@RequestBody ObsTaskAddDto orderDto){
        obsDemandService.transferTask(orderDto);
        return CommonResult.success();
    }
}
